﻿using FluentScheduler;
using Microsoft.Extensions.DependencyInjection;

namespace Basic.ScheduledTask;

public class FluentSchedulerJobFactory : IJobFactory
{
    private IServiceProvider _serviceProvider;

    public FluentSchedulerJobFactory(IServiceProvider serviceProvider)
    {
        _serviceProvider = serviceProvider;
    }

    public IJob GetJobInstance<T>() where T : IJob
    {
        return _serviceProvider.GetRequiredService<T>();
    }

}